using UnityEngine;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;

public class DistanceWithTarget : Conditional
{
	public SharedTransform Target;
	public float Distance;
	public override TaskStatus OnUpdate()
	{
	
		if(Vector3.Distance(new Vector3(Target.Value.position.x, 0, Target.Value.position.z) , new Vector3(transform.position.x, 0, transform.position.z)) <= Distance) 
		{
            return TaskStatus.Success;
        }
		else 
		{
			return TaskStatus.Failure;
		}
		
	}
}